package br.com.colegio.dao.storage;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public final class PMF
{
	private static final PersistenceManagerFactory pmfInstance =
				JDOHelper.getPersistenceManagerFactory("transactions-optional");

	private static PersistenceManager pm = null;

	private PMF()
	{
	}

	public static PersistenceManager getPersistenceManager()
	{
		if (pm == null || pm.isClosed())
			pm = pmfInstance.getPersistenceManager();

	    return pm;
	}
}